#-*-python-*-

# Main build script for TODO:___________________________



#### Stores names for the program ####

ROOT = "ROOT"

project_name = "mlc"



#### Add new source module names here ####


directories = Split("""folder static_api default""")



############### You should not need to edit below this line ############


import os

from buildhelp import src_module, check_include



# Get build environment

env = Environment()



# Checks whether the include directory exists

check_include()



# src_module() returns list for each directory.

# also loops through all of the directories in the test folder

# saves the build objects from the test folder in a different list

src_obj = []

test_obj = []

for d in directories:
	
	src_obj += src_module(env, "src", "", d)
	
	test_obj += src_module(env, "test", "Test", d)



# Temp always in debug

#env.Append(CXXFLAGS=["-g"])

#env.Append(LINKFLAGS=["-g"])



# Add a link to the include directory

cpppath = os.path.join( os.environ[ROOT], "include" )
env.Append( CPPPATH = [ cpppath ] )



# Creates Library
# Does not include objects from the test

libpath = os.path.join( os.environ[ROOT], "lib", project_name )
env.StaticLibrary( libpath, src_obj)



# Creates test binary file

# Includes the objects from the test file

target = os.path.join( os.environ[ROOT], "bin", project_name )
env.Program(target, source = [ src_obj, test_obj, "main.cc" ])
